<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 使用reduce实现数组去重
        var arr=[1,1,2,3,5,8,9,2,5,4,6,3,6,7]
        res=arr.reduce(function(pre,cur,array){
            // 判断pre数组中是否含有cur中的数据，若没有就添加
            if(pre.indexOf(cur)===-1){
                return pre.concat(cur)
            }else{
                return pre
            }
        },[])
        console.log(res);
    </script>
</body>
</html>